package com.jake.spring.cloud.rabbitmq.stomp1.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("screen")
public class ScreenController {

    @Autowired
    private SimpMessagingTemplate simpMessagingTemplate;

    @PostMapping("message")
    public void pushMessage(String msg) {
        simpMessagingTemplate.convertAndSend("/topic/rabbitmq", "rabbitmq1: " + msg);
    }

}
